'''
Author: your name
Date: 2021-01-12 09:44:27
LastEditTime: 2021-01-12 10:27:06
LastEditors: Please set LastEditors
Description: In User Settings Edit
FilePath: \Python\video.py
'''
# 功能：对视频文件进行剪切。
# 剪切指定长度的视频，选择要裁剪的视频，选择开始时间点和停止时间点即可。
# 将处理后的视频保存为output.avi文件


import cv2  # OpenCV
import tkinter.filedialog  # Python文件对话框

cap = cv2.VideoCapture("./query_video/test_video_0.mp4")

filename = tkinter.filedialog.askopenfilename()  # 弹出对话框选择需要裁剪的视频文件
cap = cv2.VideoCapture(filename)  # 打开视频文件
frames = cap.get(cv2.CAP_PROP_FRAME_COUNT)  # 获得视频文件的帧数
width = cap.get(cv2.CAP_PROP_FRAME_WIDTH)  # 获得视频文件的帧宽
height = cap.get(cv2.CAP_PROP_FRAME_HEIGHT)  # 获得视频文件的帧高

print(filename)
print(frames)


print("write successfully.")
cap.release()

